/********************************************
*
*
********************************************/


#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

#include "config.h"


extern VOID DMS_SysPidMsgFunc(DMS_MSG_HEAD * pMsg);



struct tagPidUserConfig g_stPidUserConfigTable[] = {
    {DMS_PID_SYS,   DMS_FID_SYS,     "SYS",   DMS_SysPidMsgFunc      },
    {DMS_PID_S1,    DMS_FID_S,       "S_1",   NULL          },
    {DMS_PID_S2,    DMS_FID_S,       "S_2",   NULL          },
    {DMS_PID_T1,    DMS_FID_T,       "T_1",   NULL          },
    {DMS_PID_T2,    DMS_FID_T,       "T_2",   NULL          },
    {DMS_PID_A1,    DMS_FID_A,       "A_1",   NULL          },
    {DMS_PID_A2,    DMS_FID_A,       "A_2",   NULL          },
    {DMS_PID_A3,    DMS_FID_A,       "A_3",   NULL          },
    {DMS_PID_A4,    DMS_FID_A,       "A_4",   NULL          },
    {DMS_PID_A5,    DMS_FID_A,       "A_5",   NULL          },
};

struct tagFidUserConfig g_stFidUserConfigTable[] = {
    {DMS_FID_SYS,   "SYS",     1000},
    {DMS_FID_A,     "TEST_A",  6000},
    {DMS_FID_S,     "TEST_S",  500 },
    {DMS_FID_T,     "TEST_T",  100 },
};



UINT32 DMS_FidpidUserConfig()
{
    UINT32 ulRet;
    UINT32 ulIndex;
    UINT32 ulMaxTable;

    ulMaxTable = sizeof(g_stPidUserConfigTable)/sizeof(struct tagPidUserConfig);

    for( ulIndex = 0 ; ulIndex < ulMaxTable ; ulIndex++ )
    {
        ulRet = DMS_PidInfoConfig(g_stPidUserConfigTable[ulIndex].ulPid,
                                  g_stPidUserConfigTable[ulIndex].ulFid,
                                  g_stPidUserConfigTable[ulIndex].pcName,
                                  g_stPidUserConfigTable[ulIndex].pfunc);
        if(DMS_OK != ulRet)
        {
            return ulRet;
        }
    }

    ulMaxTable = sizeof(g_stFidUserConfigTable)/sizeof(struct tagFidUserConfig);

    for( ulIndex = 0 ; ulIndex < ulMaxTable ; ulIndex++ )
    {
        ulRet = DMS_FidInfoConfig(g_stFidUserConfigTable[ulIndex].ulFid,
                                  g_stFidUserConfigTable[ulIndex].pcName,
                                  g_stFidUserConfigTable[ulIndex].ulQueLen);
        if(DMS_OK != ulRet)
        {
            return ulRet;
        }
    }

    return DMS_OK;
}



UINT32 DMS_LoadFidpid()
{
    if(DMS_OK != DMS_FidPidModuleConfig(DMS_FID_BUT,DMS_PID_BUT))
    {
        return DMS_ERR;
    }

    if(DMS_OK != DMS_FidpidUserConfig())
    {
        return DMS_ERR;
    }

    if(DMS_OK != DMS_FidPidStarter())
    {
        return DMS_ERR;
    }

    return DMS_OK;
}


#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


